﻿var createPanel = new Ext.FormPanel({
    labelWidth: 75,
    region: 'center',
    url: 'BugCreate.aspx',
    margins: '15 20 20 20',
    title: '创建新Bug',
    bodyStyle: 'padding:10px 15px 15px 15px',
    frame: true,
    autoScroll:true,
    buttonAlign: 'left',

    items: [
        {
            xtype: 'textfield',
            fieldLabel: 'Bug标题',
            name: 'title',
            blankText : '用户名不能为空',
            width: 400
        },
        {
            height: 10
        },
        {
            xtype: 'compositefield',
            fieldLabel: '项目/模块',
            items:
            [
                {
                    xtype: 'combo',
                    mode: 'local',
                    editable: false,
                    forceSelection: true,
                    displayField: 'name',
                    valueField: 'value',
                    triggerAction: 'all',
                    value: '--请选择--',
                    store: new Ext.data.JsonStore({
                        fields: ['name', 'value'],
                        data: [
                                        { name: '--请选择--', value: '--请选择--' },
                                        { name: 'Mrs', value: 'mrs' }
                                   ]
                    })
                },
                {
                    xtype: 'combo',
                    mode: 'local',
                    editable: false,
                    forceSelection: true,
                    displayField: 'name',
                    valueField: 'value',
                    triggerAction: 'all',
                    value: '--请选择--',
                    store: new Ext.data.JsonStore({
                        fields: ['name', 'value'],
                        data: [
                                        { name: '--请选择--', value: '--请选择--' },
                                        { name: 'Mrs', value: 'mrs' }
                                   ]
                    })
                }
            ]
        }, // end compositefield
        {
            height: 20
        },
        {
            xtype: 'combo',
            fieldLabel: 'Bug类型',
            name: 'type',
            mode: 'local',
            editable: false,
            forceSelection: true,
            displayField: 'name',
            valueField: 'value',
            triggerAction: 'all',
            value: '代码错误',
            store: new Ext.data.JsonStore({
                fields: ['name', 'value'],
                data: [
                                        { name: '代码错误', value: '代码错误' },
                                        { name: '界面优化', value: '界面优化' }
                           ]
            })
        },
        {
            xtype: 'combo',
            fieldLabel: '严重程度',
            name: 'type',
            mode: 'local',
            editable: false,
            forceSelection: true,
            displayField: 'name',
            valueField: 'value',
            triggerAction: 'all',
            value: '3',
            store: new Ext.data.JsonStore({
                fields: ['name', 'value'],
                data: [
                                { name: '1', value: '1' },
                                { name: '2', value: '2' }
                           ]
            })
        },
        {
            height: 20
        },
        {
            xtype: 'combo',
            fieldLabel: '指派给谁',
            name: 'type',
            mode: 'local',
            editable: false,
            forceSelection: true,
            displayField: 'name',
            valueField: 'value',
            triggerAction: 'all',
            value: '--请选择人员--',
            store: new Ext.data.JsonStore({
                fields: ['name', 'value'],
                data: [
                        { name: '李天明', value: '李天明' },
                        { name: '王刚', value: '王刚' }
                   ]
            })
        },
        {
            height: 20
        },
        {
            xtype: 'htmleditor',
            id: 'bio',
            fieldLabel: 'Biography',
            height: 240,
            width: 600
        }
    ],

    buttons: [
           {
               text: '提交',
               type: 'submit'
           },
           {
               text: '重填',
               type: 'reset',
               handler: function() {
                   createPanel.getForm().reset();
               }
           }
        ]
});



Ext.onReady(function() {

    Ext.QuickTips.init();

    // turn on validation errors beside the field globally
    Ext.form.Field.prototype.msgTarget = 'side';


    var viewport = new Ext.Viewport({
        layout: 'border',
        items: [northHeader, createPanel, southCopyright]
    }); //end Ext.Viewport

});       //end Ext.onReady